#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
  printf("I am a parent process:%d\n",getpid());

  sleep(3);

  pid_t id = fork();
  if(id == 0)
  {
    //child
    while(1)
    {
      printf("I am a child process:%d,parent process is:%d\n",getpid(),getppid());
      sleep(3);
    }
  }
  else
  {
    //parent
    while(1)
    {
      printf("I am a parent process:%d\n",getpid());
      sleep(3);
    }
  }
  return 0;
}
